package quorum;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

/*List<QuorumTask>*/
public class TodoList {
	private static TodoList instance;
	private Queue<QuorumTask> tasks;
	
	private TodoList(){
		tasks=new ConcurrentLinkedQueue<QuorumTask>();
	}
	
	public static TodoList getInstance(){
		if(instance == null)
			instance=new TodoList();
		return instance;
	}
	
	public boolean add(QuorumTask t){
		return tasks.add(t);
	}
	
	public QuorumTask peek(){
		return tasks.peek();
	}
	
	public QuorumTask poll(){
		return tasks.poll();
	}
	
	public boolean isEmpty(){
		return tasks.isEmpty();
	}
	
	public boolean clear(){
		while(!tasks.isEmpty()){
			tasks.poll();
		}
		return true;
	}
}
